<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('人员信息')"/>
    <th:block th:include="include :: datetimepicker-css"/>
</head>
<style>
    .m-b {
        margin-bottom: 0px !important;
    }

    .wrapper-content {
        padding: 0px;
    }

    .ibox {
        box-shadow: none !important;
        border: none !important;
    }

</style>
<body>
<div class="main-content">
    <form id="form-personnel-edit" class="form-horizontal" AUTOCOMPLETE="OFF">
        <input name="id"  type="hidden"  th:value="${obj.id}" />
        <h4 class="form-header h4">基本信息</h4>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label"><span style="color: red; ">*</span>姓名：</label>
                    <div class="col-sm-8">
                        <input name="name" th:value="${obj.name}" class="form-control" type="text" required>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label"><span style="color: red; ">*</span>薪资：</label>
                    <div class="col-sm-8">
                        <input name="salary" th:value="${obj.salary}" class="form-control" type="text" required>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label"><span style="color: red; ">*</span>入职时间：</label>
                    <div class="col-sm-8">
                        <input type="text" name="joinDate" th:value="${obj.joinDate}" class="form-control laydate-demo-2" placeholder="yyyy-MM-dd">
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">状态：</label>
                    <div class="col-sm-8">
                        <input name="status" id="status" th:value="${obj.status}" class="form-control" type="text">
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label"><span style="color: red; ">*</span>性别：</label>
                    <div class="col-sm-8">
                        <label th:each="gender:${genders}" class="check-box">
                            <input name="gender" class="gender" type="radio" th:value="${gender.id}" th:checked="${gender.id == obj.genderId}"  th:text="${gender.name}"/>
                        </label>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label"><span style="color: red; ">*</span>职务：</label>
                    <div class="col-sm-8">
                        <label th:each="post:${posts}" class="check-box">
                            <input name="post" class="post" type="radio" th:value="${post.id}" th:checked="${post.id == obj.postId}" th:text="${post.name}" />
                        </label>
                    </div>
                </div>
            </div>
        </div>
    </form>
</div>

<th:block th:include="include :: footer"/>
<th:block th:include="include :: layout-latest-js"/>
<th:block th:include="include :: ztree-js"/>
<th:block th:include="include :: datetimepicker-js"/>

<script type="text/javascript">

    var prefix = ctx + "personnel";


    $(function () {


        $(".datetimepicker-demo-2").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });
        layui.use('laydate', function () {
            var laydate = layui.laydate;
            laydate.render({
                elem: '.laydate-demo-2',
                type: 'date'
            });
        });
    });

    function submitHandler() {
        if ($.validate.form()) {
            var data = $("#form-personnel-edit").serializeArray();
            $.operate.save(prefix + "/edit", data);
        }
    }
</script>
</body>
</html>